#ifndef SIMULATION
#define SIMULATION
#include "basic.h"
class simulation : public basic_valiable
{
public:
    void generate_px_py_p_chuiz();
    void generate_p_chuiz_p_pingx_p();
    void generate_theta();
    void plot();
};
void simulation::generate_theta()
{
    double px, py, theta;
    for (int i = 0; i < simulation_number; i++)
    {
        px = random.Gaus(0, sigma_px);
        py = random.Gaus(0, sigma_py);
        p_chuiz = sqrt(pow(px, 2) + pow(py, 2));
        p_pingx = random.Gaus(p_0, sigma_p_pingx);
        theta = atan(p_chuiz / p_pingx);
        h1->Fill(theta);
    }
    h1->GetXaxis()->SetTitle("tehta");
    h1->GetYaxis()->SetTitle("counts");
    h1->SetTitle("");
}
void simulation::generate_p_chuiz_p_pingx_p()
{
    double px, py, p;
    for (int i = 0; i < simulation_number; i++)
    {
        px = random.Gaus(0, sigma_px);
        py = random.Gaus(0, sigma_py);
        p_chuiz = sqrt(pow(px, 2) + pow(py, 2));
        p_pingx = random.Gaus(p_0, sigma_p_pingx);
        p = sqrt(pow(p_chuiz, 2) + pow(p_pingx, 2));
        h1->Fill(p);
    }
    h1->GetXaxis()->SetTitle("p");
    h1->GetYaxis()->SetTitle("counts");
    h1->SetTitle("");
}
void simulation::generate_px_py_p_chuiz()
{
    double px, py;
    for (int i = 0; i < simulation_number; i++)
    {
        px = random.Gaus(0, sigma_px);
        py = random.Gaus(0, sigma_py);
        p_chuiz = sqrt(pow(px, 2) + pow(py, 2));
        h1->Fill(p_chuiz);
    }
    h1->GetXaxis()->SetTitle("p_chuiz");
    h1->GetYaxis()->SetTitle("counts");
    h1->SetTitle("");
}
void simulation::plot()
{
    h1->Draw("C");
}
#endif // !